#include"BinaryTree.h"

bool IsSameTree(BTNode* rootA, BTNode* rootB)
{
	if (rootA == NULL&&rootB == NULL)
		return true;
	if (rootA == NULL || rootB == NULL)
		return false;
	if (rootA->data != rootB->data)
		return false;
	return IsSameTree(rootA->left, rootB->left) && IsSameTree(rootA->right, rootB->right);
}

bool IsSubTree(BTNode* root, BTNode* subroot)
{
	if (root == NULL)
		return false;
	if (IsSameTree(root, subroot))
		return true;
	return IsSubTree(root->left, subroot) || IsSubTree(root->right, subroot);
}